package com.wzq.demospringbatch.batch.demo.chunk;

import com.wzq.demospringbatch.batch.entity.TestData;
import org.springframework.batch.item.support.ListItemReader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class ItemReaderConfigure {

    @Bean
    public ListItemReader<TestData> simpleReader() {
        List<TestData> data = new ArrayList<>();
        TestData testData1 = new TestData();
        testData1.setId(1L);
        testData1.setName("GoslingWu");
        data.add(testData1);
        TestData testData2 = new TestData();
        testData2.setId(2L);
        testData2.setName("laowang");
        data.add(testData2);
        TestData testData3 = new TestData();
        testData3.setId(3L);
        testData3.setName("");
        data.add(testData3);
        return new ListItemReader<>(data);
    }

}
